Implement amplitude damping noise model#545
Closed
Vinny010 wants to merge 1 commit into
Closed
Conversation
Add amplitude damping noise to the density-matrix simulation stack: - `amplitude_damping_channel` and `two_qubit_amplitude_damping_channel` in `graphix.channels`, returning the corresponding `KrausChannel`. The two-qubit channel is the tensor product of two independent single-qubit channels. - `AmplitudeDampingNoise` and `TwoQubitAmplitudeDampingNoise` (deriving from `Noise`), plus `AmplitudeDampingNoiseModel` (deriving from `NoiseModel`), mirroring the structure of `DepolarisingNoiseModel`. Channel parameters use a `_gamma` suffix to reflect the damping rate. - Tests covering the analytic channel action on basis and superposition states, two-qubit tensor structure, per-step noise insertion in a pattern, zero-damping/noiseless equivalence, and an end-to-end preparation-error simulation. Passes ruff, mypy --strict, pyright, and pytest locally. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Hi @Vinny010 . Thanks for re-submitting your contribution on this issue. However, since it's the last day of the hackathon, we had a few other PRs close to satisfying our requirements for the amplitude damping issue, and we have decided to accept PR #540. I will therefore close out this PR. Thanks again for your all your contributions to Graphix during this UnitaryHack, we hope to collaborate with you again! |
Contributor
Author
|
Completely understand — last day, and a close call between several submissions. Congrats to the author of #540, and no worries at all. Thank you for the thoughtful reviews throughout this UnitaryHack; it's been a genuine pleasure contributing to Graphix, and I'd love to collaborate again. 🙂 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements amplitude damping noise for the
densitymatrixbackend, closing #497. The structure followsDepolarisingNoiseModelthroughout.Channels (
graphix/channels.py)amplitude_damping_channel(gamma)— single-qubit channel with Kraus operatorstwo_qubit_amplitude_damping_channel(gamma)— tensor product of two independent single-qubit channels (the fourNoise elements (
graphix/noise_models/amplitude_damping.py)AmplitudeDampingNoiseandTwoQubitAmplitudeDampingNoise, both deriving fromNoise, exposingnqubitsandto_kraus_channel(). Thegammaparameter is validated toProbability()descriptor.Noise model
AmplitudeDampingNoiseModel(NoiseModel), mirroringDepolarisingNoiseModel: per-command damping for preparation (N), entanglement (E, two-qubit), the pre-measurement channel (M), andX/Zcorrections (conditioned on their domains), plus an optional classical readout flip viaconfuse_result. Parameters carry a_gammasuffix to make clear they are damping parameters rather than probabilities.Public symbols are exported from
graphix/noise_models/__init__.py.Soundness of the tests
The single-qubit channel has the closed form$\Phi_\gamma(\rho) = K_1 \rho K_1^\dagger + K_2 \rho K_2^\dagger$ , which gives $\Phi_\gamma(|0\rangle\langle0|) = |0\rangle\langle0|$ (the ground state is a fixed point) and $\Phi_\gamma(|1\rangle\langle1|) = \gamma|0\rangle\langle0| + (1-\gamma)|1\rangle\langle1|$ (the excited state decays with probability $\gamma$ ). On $|+\rangle$ the action is $\tfrac{1}{2}\begin{psmallmatrix}1+\gamma & \sqrt{1-\gamma}\\sqrt{1-\gamma} & 1-\gamma\end{psmallmatrix}$. On a product state the two-qubit channel equals the Kronecker product of the single-qubit results. These analytic forms are used directly as references and swept over $\gamma \in {0, 0.2, 0.5, 0.9, 1.0}$ ; trace preservation (CPTP) is asserted explicitly.
At the model level,
test_noise_model_inserts_noise_at_each_stepchecks that the correctApplyNoisecommand (channel type,gamma, target nodes, and domain) is inserted at every command kind — including that the measurement channel is applied before theM. End-to-end tests run a transpiled pattern through thedensitymatrixbackend and match the resulting density matrix against the analytic prediction, and a zero-damping model is verified to reproduce the noiseless result.CI
Locally passing on this branch:
tests/test_amplitude_damping.py(25 tests), with no regressions intest_kraus/test_noise_model;ruff,mypy, andpyrightare all clean on the new files.Happy to adjust the naming or the per-command$\gamma$ conventions to whatever fits the maintainers' preferences best.